function run(input, parameters) {
    const lookupValue = input[0].toString().trim().toLowerCase();
    const filePath = "/Users/macmost/Documents/Important Stuff/Books.numbers"; // full path
    const sheetName = "Sheet 1";
    const tableName = "My Books";

    const Numbers = Application("Numbers");
    Numbers.includeStandardAdditions = true;

    const expanded = $(filePath).stringByExpandingTildeInPath.js;
    const fileAlias = Path(expanded); // <-- use this for Numbers.open()
    const fileName  = $.NSURL.fileURLWithPath($(expanded)).lastPathComponent.js;

    // Try to find already-open document
    let doc = null;
    try {
        const openDocs = Numbers.documents();
        for (let d of openDocs) {
            if (d.name() === fileName) {
                doc = d;
                break;
            }
        }
    } catch (e) {}

    // Open file if not open
    if (!doc) {
        doc = Numbers.open(fileAlias);
        // Wait for document to finish loading (up to ~5s)
        const start = Date.now();
        while ((doc.sheets().length === 0) && (Date.now() - start < 5000)) {
            delay(0.1);
        }
    }

    if (!doc.exists()) return "Document not found";

    const sheet = doc.sheets.byName(sheetName);
    if (!sheet.exists()) return "Sheet not found";

    const table = sheet.tables.byName(tableName);
    if (!table.exists()) return "Table not found";

    const rows = table.rows();
    for (let r = 0; r < rows.length; r++) {
        const cells = rows[r].cells();
        const colA = cells[0].value().trim().toLowerCase();
        if (colA == lookupValue) {
            const result = [];
            for (let c = 0; c <= 5; c++) {
                result.push(cells[c] ? cells[c].value() : "");
            }
            return "Book: "+result[0]+"\n"+"Author: "+result[1]+"\n"+"Format: "+result[2];
        }
    }

    return "Book Not Found: "+ lookupValue;
}